package com.disease.api.service.web;

import org.springframework.stereotype.Controller;
import org.springframework.web.servlet.HandlerMapping;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
public class ViewController {
    @RequestMapping(value = "/**/{path:[^\\.]*}")
    public ModelAndView redirect(HttpServletRequest request) {
        String path = request.getRequestURI();
        // 假设你的API前缀是 '/disease/v1'，这里需要根据实际情况调整
        if (path.startsWith("/disease/v1")) {
            return new ModelAndView(); // 让Spring Boot继续处理API请求
        }
        // 转发到前端应用的index.html
        return new ModelAndView("forward:/disease/index.html");
    }


}
